package com.cloud.provider.controller;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cloud.provider.entity.BaseUser;
import com.cloud.provider.entity.Person;
import com.cloud.provider.service.BaseUserService;

@RestController
public class PersonBaseUserController {

	@Autowired
	BaseUserService baseUserService;

	@GetMapping(value = "/getPerson", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	public Person getPerson(HttpServletRequest req) {
		BaseUser user = baseUserService.getBaseUser(1);
		Person per = new Person();
		per.setPersonId(20);
		per.setName("调用其他服务提供新服务" + new Date().toGMTString());
		per.setUser(user);
		per.setUrl(req.getRequestURL().toString());
		return per;
	}
}
